package com.wn.ziroombackend.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wn.ziroombackend.entity.Cleaner;
import com.wn.ziroombackend.entity.Production;
import com.wn.ziroombackend.entity.vo.AddProduction;
import com.wn.ziroombackend.entity.vo.ProductionVo;
import com.wn.ziroombackend.mapper.ProductionMapper;
import com.wn.ziroombackend.mapper.ProductionVoMapper;
import com.wn.ziroombackend.service.ProductionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wangzhijia
 * @since 2023-02-23 02:27:54
 */
@Service
public class ProductionServiceImpl extends ServiceImpl<ProductionMapper, Production> implements ProductionService {

    private ProductionMapper productionMapper;

    @Autowired
    public void setProductionMapper(ProductionMapper productionMapper) {
        this.productionMapper = productionMapper;
    }

    @Override
    public ProductionVo findVoById(String id) {

        ProductionVo productionVo = productionMapper.selectVoById(id);

        return productionVo;
    }

    @Override
    public int addNewProduction(AddProduction addProduction) {
        int i = productionMapper.insertNewPro(addProduction);
        Integer productionId = addProduction.getProductionId();
        return productionId;
    }

    @Override
    public int editProduction(AddProduction addProduction) {
        return productionMapper.updatePro(addProduction);
    }


    /*@Override
    public PageInfo<ProductionVo> listBootByPage(Integer now, Integer size, String productionName, String categoryId) {
        PageHelper.startPage(now,size);
        List<ProductionVo> productionVoList = productionVoMapper.selectPageByCondition(productionName,categoryId);
        return new PageInfo<>(productionVoList);
    }

    @Override
    public ProductionVo findProductionById(Integer productionId) {
        ProductionVo pro = productionVoMapper.selectProductionById(productionId);
        return pro;
    }*/


    /*@Override
    public Page<Production> listBootByPage(Integer now, Integer size, String condition) {
        Page<Production> productionPage = new Page<>(now,size);

        QueryWrapper<Production> queryWrapper = new QueryWrapper<>();
        queryWrapper.like(!Objects.isNull(condition),"production_name",condition);

        Page<Production> page = productionMapper.selectPage(productionPage, queryWrapper);
        return page;
    }*/
}
